const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]
const obj = {
    name: 'ck',
    age: 20,
    date: new Date(),
    regExp: /\s+/gi,
    unde: undefined,
    child: {
        name: 'ck',
        age: 20,
        date: new Date(),
        regExp: /\s+/gi,
        cars: ['BMW', 'BENZ', 'AUDI']
    }
}


function clone(obj1) {
    let newObj = {}
     function InnerClone(obj){
        for(let item in obj){
            if(typeof obj[item] === 'object'){
                // const type = obj[item].constructor.toString().slice(9)
                console.log(obj[item].constructor.toString().slice(9))
                // console.log(type)
            }else {
                newObj[item] = obj[item]
            }
        }
    }
    InnerClone(obj1)

    return newObj
}

console.log(clone(obj));


function quickSort(arr) {
    if(!Array.isArray(arr)) return 'not a arr'

    let length = arr.length, res = [], leftArr = [], rightArr = []
    let provitIndex = Math.floor(length / 2)
    let provit = arr[provitIndex]
    arr.splice(provitIndex, 1)
    for(let item of arr){
        if(item < provit){
            leftArr.push(item)
        }else {
            rightArr.push(item)
        }
    }
    return [...quickSort(leftArr), provit, ...quickSort(rightArr)]

}



